using System;
using System.Collections;

namespace Model
{
	/// <summary>
	/// Extends the transaction class to specialize it as a recurrence.
	/// </summary>
	public class RecurrenceRecord : Transaction 
	{

		private DateTime lastTransacted;
		private RecurrencePattern pattern;
		private DateTime endDate;
		//private User myUser; // commented because it inherits from Transaction which
		//has user object as an attribute
		//private int transactionID;
		

		/// <summary>
		/// Defines the type of usable recurrence patterns available. 
		/// Enum because (ask shiv)
		/// </summary>
		/// <remarks>At any give time, to check if a recurence pattern is of a particular type, you can say:
		/// if (myRecurrence.recurrencePattern == RecurrenceRecord.RecurrencePattern.Weekly)</remarks>
		public enum RecurrencePattern
		{
			[EnumDescription("Daily")]
			Daily,
			[EnumDescription("Bi-Weekly")]
			biWeekly,
			[EnumDescription("Weekly")]
			Weekly,
			[EnumDescription("Monthly")]
			Monthly
		}




		private string recurrenceRange;

		public DateTime LastTransacted
		{	
			get
			{
				return LastTransacted;
			}
			set
			{
				LastTransacted = value;
			}
		}

		public DateTime EndDate
		{	
			get
			{
				return endDate;
			}
			set
			{
				endDate = value;
			}
		}



		public string RecurrencenRange
		{	
			get
			{
				return recurrenceRange;
			}
			set
			{
				recurrenceRange = value;
			}
		}


		public RecurrenceRecord()
		{
			//
			// TODO: Add constructor logic here
			//


		}
		/// <summary>
		/// This method will check if today is a recurring today  
		/// </summary>
		/// <returns>Boolean True or False</returns>
		private bool isOccuredToday()
		{	
			return false;
		}
		/// <summary>
		/// This method will get the next transaction date
		/// </summary>
		/// <returns></returns>
		public string FindNextTransacted()
		{
			return null;
		}
		/// <summary>
		/// This method will creat a transaction object and return it.
		/// </summary>
		/// <returns>The next transaction that will be created in the next occurance</returns>
		public Transaction ProduceNextTransaction()
		{
			return null;
		}

		/// <summary>
		/// Checks if there are any occurances that were missed
		/// </summary>
		/// <returns>true if transactions have occured beteen the last time this was viewed</returns>
		public bool isOverdue()
		{
			return true; // TODO: stub
		}


		/// <summary>
		/// generates all the transactions that have not been created since the last created occurance.
		/// Updates the last transacted date to today.
		/// </summary>
		/// <returns>A list of Transaction objects</returns>
		public ArrayList ProduceOverdueTransactions()
		{
			
			return null; // TODO: stub

		}

        /// <summary>
        /// The time until the next recurrence
        /// </summary>
        /// <returns></returns>
		public DateTime TimeToNextOccurance()
		{
			return new DateTime(0); // TODO: The time until the next recurence
		}



		


	}

	public class EnumDescription : Attribute

	{
		public string Text;
		public EnumDescription(string text)
		{
			Text = text;
		}
	}
}
